﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilsORM;
using UtilsORM.MySqlData;

namespace GatewayServerService.Data
{
    public class DBIotDeviceVariable
    {
        public DBIotDeviceVariable()
        {

        }

        /// <summary>
        /// 获取有配置变量值的设备,有条件触发能力
        /// </summary>
        /// <param name="clientGuid"></param>
        /// <param name="export">0可上传数据值，1可执指令</param>
        /// <returns></returns>
        //public List<iot_device> getHasVariableDevice(string clientGuid, int export)
        //{

        //    string sql = "select d_name,d_guid from iot_device_variable inner join iot_device on dv_model_guid=d_model_guid  where  d_c_guid in('" + clientGuid + "','00000000-0000-0000-0000-000000000000') group by d_name,d_guid";
        //    return MySqlYihongIot.GetList<iot_device>(sql);
        //}

        /// <summary>
        /// 获取设置变量能力
        /// </summary>
        /// <param name="clientGuid"></param>
        /// <param name="dguid"></param>
        /// <param name="export">0可上传数据值，1可执指令</param>
        /// <returns></returns>
        //public List<iot_device_variable> getVariableByDevice(string clientGuid, string dguid, int export)
        //{
        //    string sql = "select v_name,v_key,dv_guid from iot_device_variable inner join iot_device on dv_model_guid=d_model_guid where d_c_guid in('" + clientGuid + "','00000000-0000-0000-0000-000000000000') and d_guid='" + dguid + "'";

        //    return MySqlYihongIot.GetList<iot_device_variable>(sql);
        //}


        //public iot_device_variable getVariable(string vguid)
        //{
        //    return ef.iot_device_variable.Where(c => c.dv_guid == vguid).FirstOrDefault();
        //}

        /// <summary>
        /// 获取设置变量能力
        /// </summary>
        /// <param name="clientGuid"></param>
        /// <param name="export">0可上传数据值，1可执指令</param>
        /// <param name="dvguid"></param>
        /// <returns></returns>
        //public List<iot_device_variable> getVariableByGuid(string clientGuid, string dvguid, int export)
        //{
        //    string sql = "select a.* from iot_device_variable a inner join iot_device on dv_model_guid=d_model_guid where  d_c_guid='" + clientGuid + "' and dv_guid='" + dvguid + "'";

        //    return MySqlYihongIot.GetList<iot_device_variable>(sql);
        //}
    }
}
